package com.hbzjt2012.lesson06;

import javax.swing.*;
import java.awt.*;
import java.util.Vector;

public class TestComboboxDemo02 extends JFrame {

    public TestComboboxDemo02(){
        Container container = this.getContentPane();

        // 生成列表的内容
//        String[] contents = {"1", "2", "3"};
        Vector contents = new Vector();


        // 列表中需要放入内容
        JList list = new JList(contents);

        contents.add("zhangsan");
        contents.add("lisi");
        contents.add("wangwu");

        container.add(list);

        this.setVisible(true);
        this.setSize(500,350);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new TestComboboxDemo02();

    }
}
